new Vue({
    el:"#app",
    data:{
        movie:[],
        arr:[
            {name:"zz",id:1001},
            {name:"cc",id:1002},
            {name:"bb",id:1003},
        ]
    },
    mounted(){
        $.ajax({
            url:"http://localhost:8000/top250",
            success:(res)=> {
                res.result.forEach(item=>{
                    item.raiting = this.transformStart(item.raiting)
                })
                this.test()
                this.movie = res.result;
                console.log(this.movie)
            }
        })
    },
    methods:{
        handleClick(){
            console.log(666);
        },
        test(){
            console.log(666);
        },
        transformStart(num) {
            let arr = []
            for (let i = 0; i < 5; i++) {
                if (num > 2) {
                    arr.push(2)
                } else if (num > 0) {
                    arr.push(Number(num.toFixed(1)))
                } else {
                    arr.push(0)
                }
                num = num - 2;
            }
            return arr;
        }
    },
})